*******************************************************************************************************************************
*******************************************************************************************************************************
* Documentation for Reproduction of
* Benard 2005 TESS Survey Experiment
* TESS Race Discrimination Meta-Analysis
* Stata version 15
* Data available here: http://www.tessexperiments.org/data/benard241.html
*******************************************************************************************************************************
*******************************************************************************************************************************

* use "Benard_final.dta", clear
set more off

*******************************************************************************************************************************
*** Racial groups
*******************************************************************************************************************************

tab race_1
tab race_1, nol
gen whiteR = race_1
recode whiteR (2=0)
tab race_1 whiteR
replace whiteR = 0 if latino != 2
tab whiteR race_1
tab whiteR latino

tab race_2
tab race_2, nol
gen blackR = race_2
recode blackR (2=0)
tab race_2 blackR
replace blackR = 0 if latino != 2
tab blackR race_2
tab blackR latino

tab latino
tab latino, nol
gen hispnR = latino
recode hispnR (2 8 9=0)
tab latino hispnR

*******************************************************************************************************************************
*** Treatments
*******************************************************************************************************************************

tab BEN_CON1
tab BEN_CON1, nol

gen maleC = BEN_CON1
recode maleC (1 2=1) (3 4=0)

gen femaleC = 1 - maleC

gen blackC = BEN_CON1
recode blackC (1 3=1) (2 4=0)

gen whiteC = 1 - blackC

tab BEN_CON1 maleC
tab BEN_CON1 femaleC
tab BEN_CON1 blackC
tab BEN_CON1 whiteC

*******************************************************************************************************************************
*** Outcome variables
*******************************************************************************************************************************

tab1 product valuable hardwork cmptnt raise respect honrable prestige capable intel knowledg
tab1 product valuable hardwork cmptnt raise respect honrable prestige capable intel knowledg, nol
recode product valuable hardwork cmptnt raise respect honrable prestige capable intel knowledg (8 9=.)
tab1 product valuable hardwork cmptnt raise respect honrable prestige capable intel knowledg

alpha product valuable hardwork cmptnt raise respect honrable prestige capable intel knowledg, gen(ALPHA) std min(6) detail item
pwcorr ALPHA product valuable hardwork cmptnt raise respect honrable prestige capable intel knowledg, sig obs

sum ALPHA if whiteR==1
di r(sd)
gen ov_white_std = ALPHA/r(sd) if whiteR==1

sum ALPHA if blackR==1
di r(sd)
gen ov_black_std = ALPHA/r(sd) if blackR==1

sum ALPHA if hispnR==1
di r(sd)
gen ov_hispn_std = ALPHA/r(sd) if hispnR==1

*******************************************************************************************************************************
*** Racial manipulation check
*******************************************************************************************************************************

// No racial manipulation check

*******************************************************************************************************************************
*** Main regressions [unweighted]
*******************************************************************************************************************************

reg ov_white_std blackC maleC if whiteR==1
reg ov_black_std blackC maleC if blackR==1
reg ov_hispn_std blackC maleC if hispnR==1

*******************************************************************************************************************************
*** Limited to employed
*******************************************************************************************************************************

tab employ
tab employ, nol

reg ov_white_std blackC maleC if whiteR==1 & employ==1
reg ov_black_std blackC maleC if blackR==1 & employ==1
reg ov_hispn_std blackC maleC if hispnR==1 & employ==1
